//
//  DemoEmptyView.m
//  LYEmptyViewDemo
//
//  Created by liyang on 2017/12/1.
//  Copyright © 2017年 liyang. All rights reserved.
//

#import "XREmptyView.h"


#define MainColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]

@implementation XREmptyView

+ (instancetype)diyEmptyView{
    
    XREmptyView *emptyView = [XREmptyView emptyViewWithImageStr:@"noData" titleStr:@"暂无数据" detailStr:@"请稍后再试!"];
    
    
    return emptyView;
}

+ (instancetype)diyEmptyActionViewWithTarget:(id)target action:(SEL)action{
    
    XREmptyView *emptyView = [XREmptyView emptyActionViewWithImageStr:@"noNetwork" titleStr:@"无网络连接" detailStr:@"请检查你的网络连接是否正确!" btnTitleStr:@"重新加载" target:target action:action];
    
    emptyView.subViewMargin = 28.f;
    emptyView.contentViewOffset = - 50;
    
    emptyView.titleLabFont = [UIFont systemFontOfSize:14.f];
    emptyView.titleLabTextColor = MainColor(199, 199, 199);
    
    emptyView.actionBtnFont = [UIFont boldSystemFontOfSize:16.f];
    emptyView.actionBtnTitleColor = MainColor(199, 199, 199);
    emptyView.actionBtnHeight = 40.f;
    emptyView.actionBtnHorizontalMargin = 62.f;
    emptyView.actionBtnCornerRadius = 7.f;
    emptyView.actionBtnBackGroundColor = BACKGROUNDCOLOR;
    
    
    return emptyView;
}

- (void)prepare{
    [super prepare];
    
    self.backgroundColor = BACKGROUNDCOLOR;
    
    //如果想要DemoEmptyView的效果都不是自动显隐的，这里统一设置为NO，初始化时就不必再一一去写了
    self.autoShowEmptyView = NO;
    
//    self.titleLabTextColor = MainColor(180, 30, 50);
//    self.titleLabFont = [UIFont systemFontOfSize:18];
//
//    self.detailLabTextColor = MainColor(80, 80, 80);
}

@end
